
<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
<!-- header_eof //-->

<!-- body //-->
<table border="0" width="100%" cellspacing="3" cellpadding="3">
  <tr>
    
<!-- body_text //-->
    <td width="100%" valign="top">
<table border="0" width="100%" cellspacing="0" cellpadding="0" valign=top>
      <tr>
        <td><table border="0" width="100%" cellspacing="0" cellpadding="0" valign=top>
          <tr>
            <td class="componentheading"><?php echo HEADING_TITLE; ?></td>
           
          </tr>
        </table></td>
      </tr>
      <tr>
        <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
      </tr><tr><td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox" valign=top>
          <tr>
            <td valign=top><table border="0" width="100%" cellspacing="0" cellpadding="2" valign=top>
            <tr><td class="sectiontableheader"><?php echo TABLE_HEADING_PRODUCTS; ?></td><td class="sectiontableheader"><?php echo TEXT_TERMS; ?></td><td class="sectiontableheader">Last Bill</td><td class="sectiontableheader">Date Payed</td></tr>

<?
$orders_total = tep_count_customer_sub_payment();
if ($orders_total > 0) {
    $history_query_raw = "select sq.order_id, sq.bill_date, sq.pay_date, pd.products_name, s.pay_period_type, s.price_period, s.days_as_period from " . TABLE_SUBSCRIPTION . " sq, " . TABLE_SUBSCRIPTIONS . " s, " . TABLE_PRODUCTS_DESCRIPTION . " pd where sq.client_id = '" . (int)$customer_id . "' and s.productid = sq.product_id and pd.products_id = sq.product_id and sq.status != 'que' and pd.language_id = '" . (int)$languages_id . "' order by sq.que_id DESC";
    $history_split = new splitPageResults($history_query_raw, MAX_DISPLAY_ORDER_HISTORY);
    $history_query = tep_db_query($history_split->sql_query);
$r=0;
    while ($history = tep_db_fetch_array($history_query)) {
  if($history[pay_period_type] == 'By Period'){
  $terms = $currencies->display_price($history[price_period], tep_get_tax_rate('0')) . '  Every ' .$history[days_as_period] .' days';
  } else {
  $terms = $currencies->display_price($history[price_period], tep_get_tax_rate('0')) . '  ' . $history[pay_period_type];
  }
?> <tr class="sectiontableentry<?php echo $r+1; ?>"><td><?
echo $history[products_name] . '</td><td>' . $terms . '</td><td>' . $history[bill_date] . '</td><td>' . $history[pay_date] . '</td></tr>';
$r = 1 - $r;
}
}

?></table></td></tr>
<?php
  if (($history_split->number_of_rows > 0) && ((PREV_NEXT_BAR_LOCATION == '2') || (PREV_NEXT_BAR_LOCATION == '3'))) {
?>
<tr> <td class="main" > <table align=right><tr>
            <td class="smallText" valign="top"><?php echo $history_split->display_count(TEXT_DISPLAY_NUMBER_OF_ORDERS); ?></td>
            <td class="smallText" align="right"><?php echo TEXT_RESULT_PAGE . ' ' . $history_split->display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?></td>
          </tr></table></td></tr>
          <?php
          }
          ?>
          </table>
</td></tr></table></td>
<!-- body_text_eof //-->

  </tr>
</table>